<?php

/**
 * rmUserCompetence filter form base class.
 *
 * @package    ressourceManager
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasermUserCompetenceFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_user'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('idUser'), 'add_empty' => true)),
      'id_competence'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('idCompetence'), 'add_empty' => true)),
      'user_level'         => new sfWidgetFormChoice(array('choices' => array('' => '', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5'))),
    ));

    $this->setValidators(array(
      'id_user'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('idUser'), 'column' => 'id_user')),
      'id_competence'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('idCompetence'), 'column' => 'id_competence')),
      'user_level'         => new sfValidatorChoice(array('required' => false, 'choices' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5'))),
    ));

    $this->widgetSchema->setNameFormat('rm_user_competence_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'rmUserCompetence';
  }

  public function getFields()
  {
    return array(
      'id_user_competence' => 'Number',
      'id_user'            => 'ForeignKey',
      'id_competence'      => 'ForeignKey',
      'user_level'         => 'Enum',
    );
  }
}
